<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String productCode = request.getParameter("productCode");
%>
<div class="easyui-layout" style="width:100%;height:100%;" fit="true">
    <div data-options="region:'center',title:'',split:true" style="height:100%;">
		<form id="intrductionForm" method="post" >
			<table class="detailTable"> 
			<tr>
                <th>选择展示风格:</th> 
                <td colspan="3">
                	<input type="radio" value="1" name="userType" />字段形式
                	<input type="radio" value="2" name="userType" />富文本形式
                </td>
            </tr>
			<tr>
                <th>商品编号:</th> 
                <td>
                	<input class="easyui-validatebox"  name="productCode" value="<%=productCode %>" data-options="required:true" value="" readonly="readonly">
                </td>
                 <th>成分:</th> 
                <td>
                	<input class="easyui-validatebox"  name="iCompose" data-options="required:true" value=""  >
                </td>
            </tr>
            <tr>
                <th>性状:</th> 
                <td><input class="easyui-validatebox"  name="iCharacter" data-options="required:true" value="" ></td>
            	<th>功能主治:</th> 
                <td><input class="easyui-validatebox"  name="iFunction" data-options="required:true" value="" ></td>
            </tr>
            <tr>
                <th>用法用量:</th> 
                <td><input class="easyui-validatebox"  name="iUsage" data-options="required:true" value=""  ></td>
                <th>不良反应:</th> 
                <td><input class="easyui-validatebox"  name="iBadness" data-options="required:true" value=""  ></td>
            </tr>
			  <tr>
                <th>禁忌:</th> 
                <td><input class="easyui-validatebox"  name="iTaboo" data-options="required:true" value="" ></td>
                <th>注意事项:</th> 
                <td><input class="easyui-validatebox"  name="iNotice" data-options="required:true" value="" ></td>
            </tr>
			  <tr>
                <th>药物相互作用:</th> 
                <td><input class="easyui-validatebox"  name="iReciprocity" data-options="required:true" value="" ></td>
                <th>贮藏:</th> 
                <td><input class="easyui-validatebox"  name="iStore" data-options="required:true" value="" ></td>
            </tr>
            	<tr>
                <th>包装:</th> 
                <td><input class="easyui-validatebox"  name="iPacking" data-options="required:true" value="" ></td>
                <th>有效期:</th> 
                <td><input class="easyui-validatebox"  name="iValidity" data-options="required:true" value="" ></td>
            </tr>
			<tr>
            	<th>执行标准:</th> 
                <td colspan="3"><input class="easyui-validatebox"  name="iStandard" data-options="required:true" value="" ></td>
			</tr>
			<tr>
				<td align="center" colspan="4">
					<input type="button" onclick="submitForm()" class="button" value="提交" >
					<input type="button" onclick="pms.resetForm('intrductionForm')" class="button" value="重置" >
				</td>
			</tr>
		</table>
		</form>
    </div>
</div>  
<script>
$(function(){
	var param = {"productCode":"<%=productCode%>"}
	$.pmsAjax({
		url : '<c:url value="/product/showEmBProductIntroductionDetail.do"/>',
		data : param,
		success : function(data) {
			console.log(data);
			if(data.code=="200"){
				$('#intrductionForm').form('load', data.data.detail);
			}else{
				alertError(data.result);
			}
		}
	});
});

function submitForm(){
	$('#intrductionForm').form('submit', {
	    url:'<c:url value="/product/saveOrUpdateProductIntrduction.do"/>',
	    onSubmit: function(param){
	    	if(!$("#intrductionForm").form('validate')){
	    		return false;
	    	}
	    },
	    dataType : 'json',
	    success:function(data){
		    var ret = eval("("+data+")");
	     	if(ret.code=="200"){
	     		alertShow(ret.result);
		    }else{
		    	alertError(ret.result);
			}
	    }
	});
}
</script>
